<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
     <%  
String path = request.getContextPath();  
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path;  
%>  
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript" src="<%=basePath %>/js/jquery.js"></script>
<script type="text/javascript" src="<%=basePath %>/tiny_mce/tiny_mce.js"></script>
<link rel="stylesheet" type="text/css" href="<%=basePath %>/css/jquery-ui-1.8.16.custom.css">
<script type="text/javascript" src="<%=basePath %>/js/jquery-ui-1.8.16.custom.min.js"></script>
<title>Edit a reply</title>
<script>
tinyMCE.init({
    // General options
    mode : "textareas",
    theme : "advanced",
    //plugins : "autolink,spellchecker,pagebreak,style,,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",
    plugins:"preview,fullscreen,emotions",

    // Theme options
    theme_advanced_buttons1 : "bold,italic,underline,strikethrough,,formatselect,fontselect,fontsizeselect,|,forecolor,backcolor,|,image,link,unlink,emotions,code,|,fullscreen,preview,",
    //theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,undo,redo,|,anchor,cleanup,|,insertdate,inserttime,preview,",
    //theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,",
    //theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,spellchecker,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,blockquote,pagebreak,|,insertfile,insertimage",
    theme_advanced_buttons2 : "",
    theme_advanced_buttons3 : "",
    theme_advanced_buttons4 : "",
    theme_advanced_toolbar_location : "top",
    theme_advanced_toolbar_align : "left",
    theme_advanced_statusbar_location : "bottom",
    theme_advanced_resizing : true,
    theme_advanced_disable : "bullist,numlist,hr,removeformat,sub,sup,undo,redo,anchor,cleanup,help,indent,outdent,separator,visualaid,charmap,",    
    

    // Skin options
    skin : "o2k7",
    skin_variant : "silver",

    // Example content CSS (should be your site CSS)
    content_css : "css/example.css",

    // Drop lists for link/image/media/template dialogs
    template_external_list_url : "js/template_list.js",
    external_link_list_url : "js/link_list.js",
    external_image_list_url : "js/image_list.js",
    media_external_list_url : "js/media_list.js",

    // Replace values for the template plugin
    template_replace_values : {
            username : "Some User",
            staffid : "991234"
    }
});

function updateReply()
{
	var content= tinyMCE.getInstanceById("replyContent").getBody().innerHTML;	
	$.ajax({
		  type:"GET",
		  url: "replyAction!updateReply.action?reply.id=${reply.id }&reply.content="+content+"&pageIndex=${pageIndex}"	,
		  success: function(mess)
		  {
		   	 window.location.href="topicAction!getTopicById.action?id=${reply.topic.id}&pageIndex=${pageIndex}"
		  }
		});
}
</script>
</head>
<body>
<jsp:include page="head.jsp"></jsp:include>
<div id="mainForm" >
<font class="bigBlue">adanBreak-System forum</font><hr>
<a href="index.jsp">adanBreak-system</a>><a href="forum.jsp">forum thread</a>><a href="topicAction!getTopicById.action?id=${reply.topic.id }&pageIndex=${pageIndex}">
${reply.topic.title}</a>>Edit Reply<br><br>
<form action="replyAction!updateReply.action?reply.id=${reply.id }&reply.content=">
<textarea name="reply.content" style="width:100%;" id="replyContent">
${reply.content }
</textarea><br>
        <input type="button" value="Save"  id="post" onclick="updateReply()">
        <script>
        $("#post").button();
        </script>
</form>
</div>
</body>
</html>